#ifndef __DTA_ROP_CHECK__
#define __DTA_ROP_CHECK__

namespace dta
{
	namespace rop_check
	{
		void PIN_FAST_ANALYSIS_CALL
			_rt_check_ret( ADDRINT esp )
		{
			if( test_mem_taint(esp, sizeof(ADDRINT) ) )
			{
				printf( "ret CONTROLLED by TAINT!\n" );
				PIN_ExitProcess(0);
			}
		}
		void trace_ret( INS ins )
		{
			UINT32 uAdjust = 0;
			if( INS_OperandIsImmediate(ins,0) )
				uAdjust = INS_OperandImmediate(ins,0);

			INS_InsertCall(ins,
				IPOINT_BEFORE,
				(AFUNPTR)_rt_check_ret,
				IARG_FAST_ANALYSIS_CALL,
				IARG_REG_VALUE, REG_ESP,
				IARG_END);
		}
	}



};


#endif